/*!
 * @Author: CPS
 * @email: 373704015@qq.com
 * @Date: 2020-08-27 23:26:27
 * @Last Modified by: CPS
 * @Last Modified time: 2020-08-29 22:44:10
 * @Projectname Electron-fileWatcher
 * @file_path "D:\CPS\MyProject\Electron-fileWatcher\src\renderer\api\router\config.js"
 * @Filename "config.js"
 */
'use strict'

import configObject from '@app/fielWatcherObject'

const config = configObject()

export default {
  // 读取软件配置
  // /config/getlocal
  // 返回本地软件配置
  'getlocal': function() { return config.loaclSettings },
  'setlocal': function(data) { config.setLocalSettings(data) },

  // 读取用户配置
  // /config/getuser
  // 饭后当前用户配置
  'getuser': function() { return config.settings },
  'setuser': function(data) { config.setUserSettings(data) },

  // 保存用户配置
  'saveuser': function(savePath, savename) {
    // 数据模板
    options = {
      path: savePath ? savePath : './',
      name: savename ? savename : 'userSettings',
    }

    config.saveUserSettings(options)
  },
  // 保存软件本地配置到文件
  'savelocal': function(savePath, savename) {
    options = {}
    config.saveLocalSettings(options)
  }
}